import 'dart:async';
import 'package:dio/dio.dart';

class Api {
  static Dio dio = Dio(BaseOptions(
    baseUrl: 'http://192.168.85.108:8080/catering-api',
    connectTimeout: 10000,
    receiveTimeout: 30000,
    responseType: ResponseType.json
  ));



  Future capturePaymentIntent(paymentIntentId) async {
    Response response = await dio.post('/order/capturePaymentIntent',
        queryParameters: {'paymentIntentId': paymentIntentId},
    );
    var data = response.data;
    return data;
  }


  Future<String> getConnectionToken() async {
    Response response = await dio.post('/sys/connectionToken');
    var _data = response.data;
    if (_data != null && _data['code'] == 200) {
      return _data['result'];
    }
    return "";
  }

}
